package club.emergency.wechat.feedback.search.consumer.controller;

import club.emergency.wechat.common.response.ResponseEntity;
import club.emergency.wechat.common.utils.JsonConvert;
import club.emergency.wechat.feedback.search.consumer.service.FeedbackSearchConsumer;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Create with IntelliJ IDEA
 * Project Name: wechat
 * Package Name: club.emergency.wechat.feedback.search.consumer.controller
 * Date: 2018/12/9
 *
 * @author: 快乐的小菌菌
 * Description:
 */
@RestController
@RequestMapping("feedback-search")
public class FeedbackSearchController {

    private FeedbackSearchConsumer feedbackSearchConsumer;

    public FeedbackSearchController(FeedbackSearchConsumer feedbackSearchConsumer) {
        this.feedbackSearchConsumer = feedbackSearchConsumer;
    }

    @ApiOperation("查询反馈列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "categoryNum", value = "反馈类型编号", dataType = "integer", paramType = "query"),
            @ApiImplicitParam(name = "deal", value = "是否已处理", dataType = "integer", paramType = "query"),
            @ApiImplicitParam(name = "pageNo", value = "当前页", dataType = "integer", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "pageSize", dataType = "integer", paramType = "query"),
    })
    @PostMapping("flipList")
    public ResponseEntity flipList(
            @RequestParam("categoryNum") Integer categoryNum,
            @RequestParam("deal") Integer deal,
            @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
    ) {
        return new JsonConvert<ResponseEntity>().jsonDecode(feedbackSearchConsumer.flipList(categoryNum, deal, pageNo, pageSize), ResponseEntity.class);
    }
}
